<template>
	<view class="">
		<NavTitle :title="title" :backgroundColor='backgroundColor' @leftClick="leftClick"></NavTitle>
		<view class="module flex_ZC">
			<view class="describe"
				:class="(ymDetails.t_real ==-1 && ymDetails.a_real ==-1)?'describe_yellow':showBtn?'describe_green':'describe_blue'">
				<view class="" v-if="ymDetails.verify_status == 2 || ymDetails.verify_status == 4">
					<view class="">{{ymDetails.verify_reason}}</view>
					<view class="">反馈时间: {{ymDetails.update_time}}</view>
				</view>
				<view class="" v-if="ymDetails.verify_status == 0">
					<view class="">信息审核中，请及时返回该页面确认审核结果</view>
					<view class="">反馈时间: {{ymDetails.bank_card.create_time}}</view>
				</view>
				<view class="" v-if="ymDetails.verify_status == 3">
					<view class="">
						<view class="" v-if="ymDetails.t_real ==0 && ymDetails.a_real ==0">
							<view class="">微信商户认证信息待完成</view>
							<view class="">支付宝商户认证信息待完成</view>
							<view class="">反馈时间: {{ymDetails.update_time}}</view>
						</view>
						<view class="" v-if="ymDetails.bond_order_id == 0 &&(ymDetails.t_real ==1 || ymDetails.a_real ==1)">
							<view class="">您尚未缴纳保证金，保证金撤店后退还</view>
							<view class="">反馈时间: {{ymDetails.update_time}}</view>
						</view>
						<view class="" v-if="ymDetails.t_real ==-1 && ymDetails.a_real ==-1">
							<view class="blueColor">微信商户认证信息待完成</view>
							<view class="blueColor">支付宝商户认证信息待完成</view>
							<!-- <view class="">商户实名认证失败，请重试</view> -->
							<view class="">反馈时间: {{ymDetails.update_time}}</view>
						</view>
						<view class="" v-if="ymDetails.t_real ==-1 || ymDetails.a_real ==-1">
							<view class="" v-if="ymDetails.t_real ==-1">
								<view class="" v-if="ymDetails.a_real ==0">
									<view class="blueColor">支付宝商户认证信息待完成</view>
									<view class="">微信商户认证信息异常</view>
									<view class="">反馈时间: {{ymDetails.update_time}}</view>
								</view>
							</view>
							<view class="" v-if="ymDetails.a_real ==-1">
								<view class="" v-if="ymDetails.t_real ==0">
									<view class="blueColor">微信商户认证信息待完成</view>
									<view class="">支付宝商户认证信息异常</view>
									<view class="">反馈时间: {{ymDetails.update_time}}</view>
								</view>
							</view>
						</view>
					</view>
			
				</view>
				<view class="" v-if="ymDetails.bond_order_id != 0">
					<view class="">您已完成全部入驻流程，请登录云猫商家页面管理店铺</view>
					<view class="">反馈时间: {{ymDetails.update_time}}</view>
				</view>
			
			
			</view>
			<view class="store_box flex_ld">
				<image :src="baseUrl + '/static/ymimage/jbxx.png'" class="storeIcon" mode="aspectFill"></image>
				<view class="left_box">
					<text class="f32 c3">店铺基本信息</text>
					<view class="tips mar24">
						<view> • 店铺类型</view>
						<view> • 主体资质</view>
						<view> • 店铺信息</view>
						<view> • 账款信息</view>
					</view>
				</view>
				<view class="btns btns1" v-if="ymDetails.verify_status == 0">已提交</view>
				<view class="btns btns2" v-if="ymDetails.verify_status == 2 || ymDetails.verify_status == 4"
					@click.stop="$u.debounce(editSettle, 300)">可修改</view>
				<view class="btns btns1" v-if="ymDetails.verify_status == 3">已完成</view>
			</view>
			<view class="store_box flex_ld">
				<image :src="baseUrl + '/static/ymimage/atsq.png'" class="storeIcon" mode="aspectFill"></image>
				<view class="left_box">
					<text class="f32 c3">微信商户实名认证</text>
					<view class="tips mar24">
						<!-- <view> • 微信商户认证</view>
						<view> • 支付宝商户认证</view> -->
						<view> • 微信或支付宝商户认证至少完成一项 </view>
						<view> • 推荐全部完成 </view>
			
					</view>
				</view>
				<view class="btns btns0" v-if="ymDetails.verify_status != 3">待进行</view>
				<view class="btns btns2" v-if="ymDetails.verify_status == 3&&ymDetails.t_real !=1" @click="$u.debounce(toAtAyth(1), 300)">去完成
				</view>
				<view class="btns btns1" v-if="ymDetails.t_real ==1">已认证</view>
			</view>
			<view class="store_box flex_ld">
				<image :src="baseUrl + '/static/ymimage/atsq.png'" class="storeIcon" mode="aspectFill"></image>
				<view class="left_box">
					<text class="f32 c3">支付宝商户实名认证</text>
					<view class="tips mar24">
			
						<view> • 微信或支付宝商户认证至少完成一项</view>
						<view> • 推荐全部完成 </view>
					</view>
				</view>
				<view class="btns btns0" v-if="ymDetails.verify_status != 3">待进行</view>
				<view class="btns btns2" v-if="ymDetails.verify_status == 3&&ymDetails.a_real !=1" @click="$u.debounce(toAtAyth(2), 300)">去完成
				</view>
				<view class="btns btns1" v-if="ymDetails.a_real ==1 ">已认证</view>
			</view>
			<view class="store_box flex_ld">
				<image :src="baseUrl + '/static/ymimage/jnbzj.png'" class="storeIcon" mode="aspectFill"></image>
				<view class="left_box">
					<text class="f32 c3">缴纳店铺保证金</text>
					<view class="tips mar24">
						<view> • 关店时可退还</view>
					</view>
				</view>
				<view class="btns btns0" v-if="ymDetails.t_real !=1 && ymDetails.a_real !=1 ">待进行</view>
				<view class="btns btns2"
					v-if="(ymDetails.t_real ==1 || ymDetails.a_real ==1) && ymDetails.bond_order_id == 0" @click="$u.debounce(toPay, 300)">
					去支付</view>
				<view class="btns btns1" v-if="ymDetails.bond_order_id != 0">已完成</view>
			
			</view>
			<view class="mt40 flex_Z" v-if="ymDetails.verify_status == 3">
				<text class="f24 c9">注意：请关注法人手机签约短信，及时完成电子签约。</text>
			</view>
			
			<view class="btnsmanage flex_ld">
				<!-- #ifdef MP-WEIXIN || MP-ALIPAY -->
				<view class="service flex_dq"  v-if="!showBtn">
					<!-- #ifdef MP-WEIXIN -->
					<text class="service1">联系客服</text>
					<button class="service1" open-type="contact">联系客服</button>
					<!-- #endif -->
					<!-- #ifdef MP-ALIPAY -->
					<text class="service1">联系客服</text>
					<contact-button class="service1" tnt-inst-id="Fs0_yOao" scene="SCE01350885" />
					<!-- #endif -->
					
				</view>
				<view class="btnsmanage flex_ld" v-else>
					<view class="sign_out">
						<!-- #ifdef MP-WEIXIN -->
						<text class="sign_out">客服</text>
						<button class="sign_out" open-type="contact">客服</button>
						<!-- #endif -->
						<!-- #ifdef MP-ALIPAY -->
						<text class="">客服</text>
						<contact-button class="" tnt-inst-id="Fs0_yOao" scene="SCE01350885" />
						<!-- #endif -->
					<!-- 	<text>联系客服</text>
						<button class="sign_out" open-type="contact">联系客服</button> -->
					</view>
					<text class="service2" @click="openSeller">去管理店铺</text>
				</view>
				<!-- #endif -->
			
				<!-- #ifdef H5 -->
				<view class="service flex_dq" @click="isSetUp" v-if="!showBtn">
					<text class="service1">联系客服</text>
				</view>
				<view class="btnsmanage flex_ld" v-else>
					<text class="sign_out" @click="isSetUp">客服</text>
					<text class="service2" @click="openSeller">去管理店铺</text>
				</view>
				<!-- #endif -->
			</view>
		</view>
		
		<u-popup :show="tipShow" mode="bottom" @close="tipShow=false" :closeable="false" bgColor="transparent"
			:closeOnClickOverlay="true">
			<view class="popup-content">
				<!-- <image :src="baseUrl + '/static/ymimage/storebg.png'" class="guanlibg" mode="aspectFill"></image> -->
				<view class="wrapss">
					<view class="f30 c3">
						店铺管理、商品管理、订单管理和更详细的数据统计等功能，请在福叠猫商家后台电脑版进行操作。
					</view>
					<view class="mr20 c3 f30">
						初次登录请使用手机号密码验证码登录，密码默认为手机号前6位，登录成功后请及时更改密码，防止资产损失。
					</view>
					<view class="mr20">
						福叠猫商家后台电脑版地址:
					</view>
					<view class="wrapss_box flex_c">
						<text class="wrapss_wz">{{content}}</text>
						<image :src="baseUrl + '/static/ymimage/copy.png'" class="copy" @click="copy" mode="aspectFill"></image>
					</view>
					<view class="service flex_dq" @click="$u.debounce(nextStep, 300)">
						<text class="service1">确定</text>
					</view>
				</view>

			</view>
		</u-popup>
	</view>
</template>

<script>
	import {
		baseURL
	} from "../../utils/request.js"
	import ymJoinIndexVue from "./ymJoinIndex.vue";
	import {
		openSeller,
		settledDetails
	} from '@/api/settled.js'
	export default {
		data() {
			return {
				title: "入驻总览",
				backgroundColor: "",
				baseUrl: this.$imageBaseUrl,
				shenheType: 1,
				shopType: 0,
				showBtn: false,
				tipShow: false,
				ymDetails: {},
				content: "",
				firstNum: 0
			}
		},
		// 页面滚动
		onPageScroll: function(e) {
			const scrollTop = e.scrollTop; // 获取页面滚动位置
			// 根据滚动位置修改状态栏样式
			if (scrollTop > 20) {
				this.backgroundColor = '#ffffff';
			} else {
				this.backgroundColor = '';
			}
		},
		onLoad() {
			this.ymDetails = JSON.parse(uni.getStorageSync('ymShopDetails')) || {}
			if (this.ymDetails.bond_order_id != 0) {
				this.showBtn = true
			}
			
			
		},
		
		onShow() {

			let firstNum = uni.getStorageSync('firstNum') || 0
			if (firstNum > 0) {
				this.firstNum = uni.getStorageSync('firstNum')
			} else {
				uni.setStorageSync('firstNum', 1)
			}
			let url = uni.getStorageSync('routeUrl') || ''
			if(url == 'pageYm/ymJoin/ymATAuthorize'){
				this.gettledDetails()
			}
		},
		// onUnload() {
		// 	console.log(123);
		// 	uni.switchTab({
		// 		url: '/pages/index/mine'
		// 	})
		// 	// this.leftClick()
		// },
		methods: {
			gettledDetails(){
				uni.showLoading({
					title:'加载中',
					mask:true
				})
				settledDetails().then(res=>{
					this.ymDetails = res.data
					uni.setStorageSync('ymShopDetails',JSON.stringify(res.data))
					uni.setStorageSync('routeUrl', '')
					uni.hideLoading()
				})
			},
			isSetUp() {
				// #ifdef H5
				window.location.href = "https://work.weixin.qq.com/kfid/kfc14a581293b68850f"
				// #endif
			},
			toAtAyth(type) {
				uni.navigateTo({
					url: '/pageYm/ymJoin/ymATAuthorize?type=' + type
				})
			},
			editSettle() {
				let modifyState = true
				uni.navigateTo({
					url: '/pageYm/ymJoin/chooseAStore?modifyState=' + modifyState
				})
			},
			openSeller() {
				const data = {
					open_seller: 1
				}
				openSeller(data).then(res => {
					console.log(res);
					if (res.code == 1) {
						this.tipShow = true
						this.content = res.data
					}

				})
			},
			leftClick() {
				console.log(123456);
				//获取页面栈的长度
				// const canNavBack = getCurrentPages()
				// console.log(canNavBack.length);
				// 判断是否刷新了浏览器，刷新了浏览器，页面栈只有当前一个
				uni.switchTab({
					url: '/pages/index/mine'
				})
				// uni.$emit('back', {key: 'ymJoinzl'});
				// uni.navigateBack()
			},
			toPay() {
				uni.navigateTo({
					url: '/pageYm/ymJoin/shopDeposit?money=' + this.ymDetails.earnest_money
				})
			},
			nextStep() {
				this.tipShow = false
				uni.setClipboardData({
					data: this.content,
					showToast: false,
					success: function() {
						console.log('success');
					}
				});
			},
			copy() {
				uni.setClipboardData({
					data: this.content,
					showToast: false,
					success: function() {
						uni.$u.toast('复制成功');
						console.log('success');
					}
				});
			}
		}
	}
</script>
<style>
	
	.service1 {
		width: 686rpx;
		height: 88rpx;
		line-height: 88rpx;
		font-size: 32rpx;
		color: #333333;
		font-weight: 500;
		text-align: center;
		background: #FFCC28;
		border-radius: 20rpx;
		position: relative;
	}
	
	.sign_out {
		width: 158rpx;
		height: 88rpx;
		font-size: 32rpx;
		color: #333333;
		line-height: 88rpx;
		text-align: center;
		background: #FFFFFF;
		font-weight: 500;
		border-radius: 20rpx;
		border: 2rpx solid rgba(153, 153, 153, 0.18);
		position: relative;
	}
	contact-button{
		width: 100%;
		height: 100%;
		position: absolute;
		left: 0;
		top: 0;
		opacity: 0 !important;
	}
</style>
<style scoped>
	.service {
		width: 686rpx!important;
	}
	.module {
		width: 750rpx;
		/* margin: 0 auto; */
		padding: 0 32rpx;
	}

	.describe_yellow {
		background: rgba(250, 110, 1, 0.1);
		color: #FA6E01;
	}

	.describe_blue {
		background: rgba(1, 146, 250, 0.1);
		color: #0192FA;
	}

	.blueColor {
		color: #0192FA;
	}

	.describe_green {
		background: rgba(1, 250, 92, 0.1);
		color: #52B275;
	}

	.describe {
		width: 686rpx;

		border-radius: 10rpx;
		font-size: 22rpx;

		margin: 8rpx 0;
		padding: 8rpx 16rpx;
		display: flex;
		align-items: flex-start;
	}

	.remind {
		width: 22rpx;
		height: 22rpx;
		margin-right: 8rpx;
		margin-top: 7rpx;
	}

	.store_box {
		position: relative;
		width: 686rpx;
		height: 236rpx;
		background: #ffffff;
		border-radius: 12rpx;
		padding: 20rpx 32rpx;
		margin-top: 24rpx;
	}

	.storeIcon {
		width: 686rpx;
		height: 236rpx;
		position: absolute;
		z-index: 1;
	}

	.tips {
		font-weight: 400;
		font-size: 24rpx;
		color: #3D3D3D;
	}

	.btns1 {
		background: #D9D9D9;
		font-size: 28rpx;
		color: #FFFFFF;
	}

	.btns0 {
		background: rgba(255, 195, 0, .5);
		font-size: 28rpx;
		color: #999999;
	}

	.btns2 {
		background: #FFC300;
		font-size: 28rpx;
		color: #333333;
	}

	.btns {
		width: 180rpx;
		height: 60rpx;
		border-radius: 74rpx 74rpx 74rpx 74rpx;
		line-height: 60rpx;
		text-align: center;
		z-index: 3;
	}

	.mar24 {
		margin-top: 24rpx;
	}

	.left_box {
		height: 100%;
		align-items: flex-start;
		z-index: 3;
	}

	.btnsmanage {
		position: fixed;
		bottom: 0rpx;
		left: 50%;
		transform: translateX(-50%);
		width: 690rpx;
		height: 150rpx;
		/* background: #f8f8f8; */
	}

	.service1 {
		width: 686rpx;
		height: 88rpx;
		line-height: 88rpx;
		font-size: 32rpx;
		color: #333333;
		font-weight: 500;
		text-align: center;
		background: #FFCC28;
		border-radius: 20rpx;
	}

	

	.popup-content {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 48rpx;
		width: 750rpx;
		min-height: 630rpx;
		overflow: auto;
		background: #FFFFFF;
		border-radius: 40rpx 42rpx 0rpx 0rpx;


	}

	.guanlibg {
		width: 750rpx;
		height: 746rpx;
	}

	.popup-title {
		margin-top: 40rpx;
		font-weight: 700;
		font-size: 32rpx;
		color: #333333;
	}

	.popup-center {
		display: flex;
		align-items: center;
		justify-content: center;
		overflow: auto;
	}

	.wrapss {
		position: absolute;
		top: 60rpx;
		padding: 0 40rpx;
	}

	.mr20 {
		margin: 20rpx 0;
	}

	.wrapss_box {
		width: 668rpx;
		height: 70rpx;
		background: #F2F2F2;
		border-radius: 12rpx;
		margin-bottom: 40rpx;
	}

	.wrapss_wz {
		width: 600rpx;
		font-size: 32rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.copy {
		width: 24rpx;
		height: 24rpx;
		margin-left: 10rpx;
	}

	.mt40 {
		margin-top: 40rpx;
		position: relative;
		width: 686rpx;
		height: 236rpx;
		border-radius: 12rpx;
		padding: 20rpx 32rpx;
		margin-top: 24rpx;
	}

	.hint {
		font-weight: 400;
		font-size: 26rpx;
		color: #3D3D3D;
		line-height: 47rpx;
		text-indent: 2em;
	}

	.sign_out {
		width: 158rpx;
		height: 88rpx;
		font-size: 32rpx;
		color: #333333;
		line-height: 88rpx;
		text-align: center;
		background: #FFFFFF;
		font-weight: 500;
		border-radius: 20rpx;
		border: 2rpx solid rgba(153, 153, 153, 0.18);
	}
/* .service2 {
		width: 686rpx;
		height: 88rpx;
		line-height: 88rpx;
		font-size: 32rpx;
		color: #ffffff;
		font-weight: 500;
		text-align: center;
		background: #CBCBCB;
		border-radius: 20rpx;
	} */
	.service2 {
		position: relative;
		width: 504rpx;
		height: 88rpx;
		line-height: 88rpx;
		font-size: 32rpx;
		color: #333333;
		font-weight: 500;
		text-align: center;
		background: #FFCC28;
		border-radius: 20rpx;
	}
</style>